jQuery(document).ready(function($) {
  var currentUser;
  var isinitMunuRequired=true;
   if(currentUser){
        init();
   }else{
     $.ajax({
                     url : "/job/user/current",
                     async : false,
                     type : "GET",
                     contentType : 'application/json',
                     dataType : 'json',
                     success : function(data) {
                         currentUser=data.data;
                         init();
                     }
           });

   }

   function init(){
         let roleName=(currentUser.roleList)[0].role;
         console.log(roleName);
        if("求职者"==roleName&&isinitMunuRequired){

              $("#leftdiv").load("/job/leftmenu.html");
              isinitMunu=false
         }else if("企业"==roleName&&isinitMunuRequired){
              $("#leftdiv").load("/job/leftmenu2.html");
               isinitMunu=false
         }

          console.log(currentUser.name);
         $('#loginname').html(currentUser.name);
   }

});
